<template>
  <el-container class="result-container">
     <el-header class="header" height="80px">
        <span class="title">顺丰快递数据查询</span>
     </el-header>
        <el-container>
          <el-aside width="250px" class="side-menu">
            <side-menu></side-menu>
          </el-aside>
          <el-main class="right-container">
                  <info-bar class="info-bar" :info="info"></info-bar>
                  <container-list v-show="mySearchResult_mode === 'list'"></container-list>
                  <container-card v-show="mySearchResult_mode === 'card'"></container-card>
          </el-main>
        </el-container>
  </el-container>
</template>
<script>
import sideMenu from './blocks/side-menu'
import infoBar from './blocks/info-bar'
import containerList from './blocks/container-list'
import containerCard from './blocks/container-card'
import {mapState} from 'vuex'
import {getViewMode, setViewMode} from '@/helper/cookie'
export default {
    components: {
      sideMenu,
      infoBar,
      containerList,
      containerCard
    },
    data () {
      return {
        info: {
          condition: '123213213',
          hit: 2343,
          source: '资源表',
          time: '232ms'
        }
      }
    },
    computed: {
      ...mapState(['mySearchResult_mode'])
    },
    created() {
      let viewMode = getViewMode();
      if(!viewMode) {
        setViewMode('card');
      } else {
        this.$store.commit('mySearchResult_mode', viewMode);
      }
      this.$store.commit('mySearchResult_query', {
          key: this.$route.query.keyword,
          fw: this.$route.query.fw,
          sjd: this.$route.query.sjd,
          kssj: this.$route.query.kssj,
          jssj: this.$route.query.jssj,
          region: this.$route.query.region
      })
    }
  }
</script>
